Xbasic

STATUSBAR.PERCENT Function

IN THIS PAGE

Syntax

.Percent(N count,N of[,C format])

Arguments

count

An expression that determines the current iteration of a task.

of

The total number of iterations.

format

Optional. Any text that includes one or more of the following placeholders.

"$c" = count argument (i.e. the first argument of the method)
"$o" = OF argument (i.e. the second argument of the method)
"$p" = percent complete (i.e. $o/$c)
"$g" = graphic placeholder allows the percent meter to be placed anywhere within text. If omitted, the graphic is located before the text.
"$b" = abort button. The default text is "Abort" unless you specify alternate text between the {} delimiters (i.e. $b{Quit import...}).
"$h" = abort hyperlink. The default text is "Abort" unless you specify alternate text between the {} delimiters (i.e. $h{Quit import...}).

Description

The STATUSBAR.PERCENT() method displays a bar graph on the Status Bar showing the percent completion of a task. Use this method when you know the total number of iterations in a task. If you do not know how many iterations a task has, use the STATUSBAR.ROBOT() method instead.

Refresh Rate

The default refresh rate of the Status Bar is every 0.1 second. You may set the refresh rate of the Status Bar using A5.SYSTEM_MODE_SET() or through the Settings dialog. Note that higher refresh rates may slow down your program.

Example

Displays the percent completion of a task.

dim tbl as P
dim total_records as N
dim iterations as N = 0
tbl = table.open("c:\a5\a_sports\customer")
total_records = tbl.records_get()
tbl.fetch_first()
while .not. tbl.fetch_eof()
    tbl.fetch_next()
    iterations = iterations + 1
    statusbar.percent(iterations,total_records)
    'Put in code that does something to each record here
end while
statusbar.clear()

Examples with the optional format string.

statusbar.Percent(50, 100, "Record $c of $o")
statusbar.Percent(50, 100, "Operation is $p percent complete")

Refer to STATUSBAR.ABORT_CHECK() for additional examples.

Limitations

Desktop applications only.

See Also